
************************
***Low to high events
************************


use "/Users/sokolins/Dropbox/Ideas/PortfolioManagersSalariesUpdated/JFQA Replication Package May 2025/Code/rep_did_data", clear

keep if event_LTH==1 

tab t, gen(tyear)


foreach i of numlist 1/2 4/6 {

	gen treat_tyear`i' = treat*tyear`i'
	
}


*Regress y on the interaction. Get point estimates and their standard errors.
local y "del_visibility"
local controls "l_skill l_visibility l_t_visibility l_revenue l_manager_age l_fund_exp extra_role l_nfunds equity l_team_fund_exp l_team_size l_team_manager_age team_equity_share"

reghdfe `y' treat_tyear* `controls', a(License#event_id firm#year) nocon vce(cl  License year)

foreach i of numlist 1/2 4/6  {
	
	gen b_week`i' = _b[treat_tyear`i']
	gen se_week`i' = _se[treat_tyear`i']
}

*Keep estimates and standard deviations
keep b_week* se_week*
gen id=_n
keep if id==1
reshape long b_week se_week, i(id)
drop id

*Set the treatment year (year = 4) to be zero. 
insobs 1
replace _j = 3 if missing(_j)
replace b_week = 0 if missing(b_week)
replace se_week = 0 if missing(se_week)

replace _j=_j - 4
sort _j

*Confidence intervals
gen h = b_week + 1.96*se_week
gen l = b_week - 1.96*se_week

*Plot
gen c = 0.4 if _j >= 0
set scheme s1color
tw bar c _j if _j >= 0, bcolor(gs14) base(-0.4) || ///
	connected b_week _j, mcol(navy) lcol(navy) lp(l) ///
	xtitle("Year (Transition Year = 0)") || ///
	function y = 0, range(-3 2) lcol(maroon) lp(-) || ///
	rcap h l _j, mcol(navy) lcol(navy) lp(_) ///
	title("Panel (a): Transitions from Low-Visibility to High-Visibility Team", size(medium)) ///
	ylabel(-0.4 (0.1) 0.4, angle(0)) legend(off) ///
	xlabel(-3 (1) 2, valuelabel) ///
	ytitle("Visibility Growth") ///
	


************************
***High to Low events
************************



use "/Users/sokolins/Dropbox/Ideas/PortfolioManagersSalariesUpdated/JFQA Replication Package May 2025/Code/rep_did_data", clear
keep if event_HTL==1 

tab t, gen(tyear)


foreach i of numlist 1/2 4/6 {

	gen treat_tyear`i' = treat*tyear`i'
	
}

*Regress y on the interaction. Get point estimates and their standard errors.
local y "del_visibility"
local controls "l_skill l_visibility l_t_visibility l_revenue l_manager_age l_fund_exp extra_role l_nfunds equity l_team_fund_exp l_team_size l_team_manager_age team_equity_share"

qui: reghdfe `y' treat_tyear* `controls', a(License event_id year) nocon vce(cl  License year)


foreach i of numlist 1/2 4/6  {
	
	gen b_week`i' = _b[treat_tyear`i']
	gen se_week`i' = _se[treat_tyear`i']
}

*Keep estimates and standard deviations
keep b_week* se_week*
gen id=_n
keep if id==1
reshape long b_week se_week, i(id)
drop id

*Set the treatment year (year = 4) to be zero. 
insobs 1
replace _j = 3 if missing(_j)
replace b_week = 0 if missing(b_week)
replace se_week = 0 if missing(se_week)

replace _j=_j - 4
sort _j

*Confidence intervals
gen h = b_week + 1.96*se_week
gen l = b_week - 1.96*se_week


*Plot
gen c = 0.4 if _j >= 0
set scheme s1color
tw bar c _j if _j >= 0, bcolor(gs14) base(-0.4) || ///
	connected b_week _j, mcol(navy) lcol(navy) lp(l) ///
	xtitle("Year (Transition Year = 0)") || ///
	function y = 0, range(-3 2) lcol(maroon) lp(-) || ///
	rcap h l _j, mcol(navy) lcol(navy) lp(_) ///
	title("Panel (b): Transitions from High-Visibility to Low-Visibility Team", size(medium)) ///
	ylabel(-0.4 (0.1) 0.4, angle(0)) legend(off) ///
	xlabel(-3 (1) 2, valuelabel) ///
	ytitle("Visibility Growth") ///
	


